package tech.edwardvan.springbootdemo;

import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import tech.edwardvan.springbootdemo.init.DemoApplicationContextInitializer2;
import tech.edwardvan.springbootdemo.listener.DemoApplicationListener2;

/**
 * 项目启动入口
 *
 * @author EdwardVan
 */
@SpringBootApplication
public class SpringBootDemoApplication {

    public static void main(String[] args) {
        // 启动方式一
        //SpringApplication.run(SpringBootDemoApplication.class, args);
        // 启动方式二
        ConfigurableApplicationContext run = new SpringApplicationBuilder(SpringBootDemoApplication.class)
                //添加系统初始化器2
                .initializers(new DemoApplicationContextInitializer2())
                //添加应用事件监听器2
                .listeners(new DemoApplicationListener2())
                .web(WebApplicationType.SERVLET)
                .properties("properties.priority.test:prioritytest-1")
                .run(args);
    }

}
